package com.haoshuang.zhouzhoubang.model.http

import com.mufeng.libs.utils.NetworkUtil
import com.mufeng.libs.utils.application
import okhttp3.CacheControl
import okhttp3.Interceptor
import okhttp3.Response
import java.io.IOException

class NetworkStatusInterceptor: Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val request = chain.request()

        val response = chain.proceed(request)
        if (!NetworkUtil.isNetworkAvailable(application)) {
            throw IOException("网络连接不可用")
        }
        return response
    }
}